package com.qf.action;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;
import com.qf.model.Telbook;
import com.qf.model.User;
import com.qf.service.impl.UserServiceImpl;

/**
 * Servlet implementation class ChakanAll
 */
public class ChakanAll extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private UserServiceImpl userServiceImpl=new UserServiceImpl(); 
   
    public ChakanAll() {
        super();
        // TODO Auto-generated constructor stub
    }

	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	
	response.setContentType("text/html;charset=utf-8");
	
	int uid=Integer.parseInt(request.getParameter("uid"));
	List<Telbook> list=userServiceImpl.showAll(uid);
	Gson gson=new Gson();
	String json=gson.toJson(list);
	response.getWriter().write(json);
	
	
	
	
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
